// src/utils/axios.ts
import axios from 'axios';

const instance = axios.create({
  baseURL: '/api', // 替换为你的 API 地址
  timeout: 10000,
});

instance.interceptors.request.use(
  (config) => {
    const token = localStorage.getItem('token'); // 如果需要使用 localStorage 存储 token
    if (token) {
      config.headers.Authorization = `${token}`;
    }
    return config;
  },
  (error) => Promise.reject(error)
);

export default instance;
